package cn.sheep.dmp.utils

/**
  * Sheep.Old @ 64341393
  * Created 2018/3/29
  */
object CaluAdKpi {

    def caluAdCost(efft: Int, bill: Int, iswin: Int, cb: Double, xf: Double) = {
        // List(广告成本	广告消费)
        val adCost = if (efft == 1 && bill == 1 && iswin == 1) List[Double](cb, xf) else List[Double](0, 0)
        adCost
    }

    def caluAdShowClick(rmode: Int, efft: Int) = {
        // List(展示量	点击量)
        val adShowClick = if (efft == 1 && rmode == 2) List[Double](1, 0)
        else if (efft == 1 && rmode == 3) List[Double](0, 1)
        else List[Double](0, 0)
        adShowClick
    }

    def caluAdRbt(efft: Int, bill: Int, isbid: Int, iswin: Int, adoid: Int) = {
        // List(参与竞价数,竞价成功数)
        val adRtb = if (efft == 1 && bill == 1) {
            if (isbid == 1 && adoid != 0) List[Double](1, 0)
            else if (iswin == 1) List[Double](0, 1)
            else List[Double](0, 0)
        } else List[Double](0, 0)
        adRtb
    }

    def caluAdReq(rmode: Int, pnode: Int) = {
        // List(原始请求,有效请求,广告请求)
        val adReq = if (rmode == 1) {
            if (pnode == 3) List[Double](1, 1, 1)
            else if (pnode >= 2) List[Double](1, 1, 0)
            else if (pnode >= 1) List[Double](1, 0, 0)
            else List[Double](0, 0, 0)
        } else List[Double](0, 0, 0)
        adReq
    }

}
